﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RealWorldObjects
{
    class Group
    {
        public string groupName;
        public List<Student> students = new List<Student>();
        public static int groupCount;

        public static Group generateRandomGroup()
        {
            groupCount++;
            Group group = new Group();
            group.groupName = "Group " + Group.groupCount;
            for (int i = 0; i<5; i++)
            {
                Student student = Student.GenerateRandomStudent();
                group.students.Add(student);
            }
            return group;
        }
        public void PrintGroupToConsole()
        {
            Console.WriteLine("**********************************");
            Console.WriteLine("{0}", groupName);
            Console.WriteLine("**********************************");
            foreach (var student in students)
            {
                student.PrintStudentInfoToConsole();
            }
        }
        public void PrintGroupToConsoleLowerThan50()
        {

            Console.WriteLine("**********************************");
            Console.WriteLine("{0}", groupName);
            Console.WriteLine("**********************************");
            foreach (var student in students)
            {
                if (student.CalculateAverageMark()>50)
                {
                    student.PrintStudentInfoToConsole();
                }
            }
        }
    }
}
